<template>
  <el-dialog
    title="作者信息"
    :visible="visible"
    width="300px"
    center
    :modal="false"
    @close="handleClose">
    <div class="author-content">
      <p class="qgroup-text">王天紫</p>
      <p class="qgroup-text">Q群：946291604</p>
      <!-- <el-button 
        type="primary" 
        @click="joinQQGroup"
        class="join-btn">
        一键加群
      </el-button> -->
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: {
    visible: Boolean
  },
  methods: {
    handleClose() {
      // 不直接修改 this.visible，而是通过事件通知父组件
      this.$emit('update:visible', false);  // 触发自定义事件
    },
    joinQQGroup() {
      const qqGroupUrl = `https://jq.qq.com/?_wv=1027&k=946291604`
      if (window.require) {
        try {
          const { shell } = window.require('electron')
          shell.openExternal(qqGroupUrl)
        } catch (error) {
          console.error('打开QQ群失败:', error)
          window.open(qqGroupUrl, '_blank')
        }
      } else {
        window.open(qqGroupUrl, '_blank')
      }
    }
  }
}
</script>

<style scoped>
.author-content {
  text-align: center;
  padding: 20px;
}

.qgroup-text {
  font-size: 16px;
  margin-bottom: 20px;
  color: #333;
  font-weight: bold;
}

.join-btn {
  width: 100%;
  height: 40px;
  font-size: 14px;
}
</style>